﻿--[[
    Показывает в уголке экрана FPS счетчик.

    клиент
]]

local sw, sh = guiGetScreenSize()
local x, y = 5, sh - 3 - dxGetFontHeight( 1, 'default-bold' )

local fpsText = 'FPS: 30'
local fpsCounter = 0
local fpsColor = tocolor(255,255,255,128)











addEventHandler( 'onClientResourceStart', resourceRoot,
    function()
        setTimer (
            function()
                fpsText = 'FPS: ' .. tostring(fpsCounter)
                fpsCounter = 0
            end,
            1000,
            0
        )
    end
)

addEventHandler( 'onClientRender', root,
    function()
        fpsCounter = fpsCounter + 1
        dxDrawText( fpsText, x,y,0,0, fpsColor,1, 'default-bold' )
    end
)
